class Solution2 {
    public void moveZeroes(int[] nums) {
        for (int cur = 0, dest = -1; cur < nums.length; cur++) {
            if (nums[cur] != 0) {
                int tmp = nums[cur];
                nums[cur] = nums[dest+1];
                nums[dest+1] = tmp;
                dest++;
            }
        }
    }
}